package com.finance.report.service;

import com.finance.framework.lang.Page;
import com.finance.framework.lang.PageResultBO;
import com.finance.report.bean.pojo.PieceResultList;
import com.finance.report.bean.pojo.WeightResultList;
import com.finance.report.dao.CalculateResultMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * Created by liyue on 2017/8/21.
 */
@Service
public class CalculateResultService implements ICalculateResultService {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private CalculateResultMapper calculateResultMapper;

    @Override
    public List<Map<String,String>> suffixList(){
        return calculateResultMapper.suffixList();
    }

    @Override
    public PageResultBO<PieceResultList> pieceListByPage(Page page) {
        PageResultBO<PieceResultList> pageResultBO = new PageResultBO<PieceResultList>();
        List<PieceResultList> pieceResultLists = calculateResultMapper.pieceListByPage(page);
        pageResultBO.setPageSize(page.getPageSize());
        pageResultBO.setPageNo(page.getPageNo());
        pageResultBO.setTotalRecord(page.getTotalRecord());
        pageResultBO.setDataList(pieceResultLists);
        return pageResultBO;
    }

    @Override
    public PageResultBO<WeightResultList> weightListByPage(Page page) {
        PageResultBO<WeightResultList> pageResultBO = new PageResultBO<WeightResultList>();
        List<WeightResultList> weightResultLists = calculateResultMapper.weightListByPage(page);
        pageResultBO.setPageSize(page.getPageSize());
        pageResultBO.setPageNo(page.getPageNo());
        pageResultBO.setTotalRecord(page.getTotalRecord());
        pageResultBO.setDataList(weightResultLists);
        return pageResultBO;
    }
}
